﻿@using HotelRegistrationSystem.HtmlExtensions
@model HotelRegistrationSystem.Models.HotelViewModel
@{
    ViewBag.Title = "Add hotel";
}

@Styles.Render("~/Content/themes/start/css")

@using (Html.BeginForm("Create", "Hotel", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <div class="row">
        <div class="six columns">
            <div class="row">
                <div class="six columns">
                    <h2>Hotel information</h2>
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.Name)
                    @Html.TextBoxFor(model => model.Name)
                    @Html.ValidationMessageFor(model => model.Name)
                </div>
                <div class="six columns">
                    @Html.LabelFor(model => model.Stars)
                    @Html.TextBoxFor(model => model.Stars)
                    @Html.ValidationMessageFor(model => model.Stars)
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.EarliestCheckIn)
                    @Html.TextBoxFor(model => model.EarliestCheckIn,
                        new { id = "EarliestCheckIn", placeholder = "Earliest Check In" })
                    @Html.ValidationMessageFor(model => model.EarliestCheckIn)
                </div>
                <div class="six columns">
                    @Html.LabelFor(model => model.LatestCheckOut)
                    @Html.TextBoxFor(model => model.LatestCheckOut,
                        new { id = "LatestCheckOut", placeholder = "Latest Check Out" })
                    @Html.ValidationMessageFor(model => model.LatestCheckOut)
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.PhoneNumber)
                    @Html.TextBoxFor(model => model.PhoneNumber)
                    @Html.ValidationMessageFor(model => model.PhoneNumber)
                </div>
                <div class="six columns">
                    @Html.LabelFor(model => model.Email)
                    @Html.TextBoxFor(model => model.Email)
                    @Html.ValidationMessageFor(model => model.Email)
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.Earnest)
                    @Html.TextBoxFor(model => model.Earnest)
                    @Html.ValidationMessageFor(model => model.Earnest)
                </div>
                <div class="six columns">
                    @Html.LabelFor(model => model.NewImage)
                    @Html.FileFor(model => model.NewImage)
                    @Html.ValidationMessageFor(model => model.NewImage)
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.ReservationDenyPeriod)
                    @Html.TextBoxFor(model => model.ReservationDenyPeriod)
                    @Html.ValidationMessageFor(model => model.ReservationDenyPeriod)
                </div>
                <div class="six columns">
                    @Html.LabelFor(model => model.ContactPeriod)
                    @Html.TextBoxFor(model => model.ContactPeriod)
                    @Html.ValidationMessageFor(model => model.ContactPeriod)
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.HotelTypeId)
                    @Html.DropDownList("HotelTypeId")
                    @Html.ValidationMessageFor(model => model.HotelTypeId)
                </div>
                <div class="six columns">
                    @Html.LabelFor(model => model.ReservationTypeId)
                    @Html.DropDownList("ReservationTypeId")
                    @Html.ValidationMessageFor(model => model.ReservationTypeId)
                </div>
            </div>
            <br />

            <div class="row">
                <div class="twelve columns">
                    @Html.LabelFor(model => model.HotelDescription)
                    @Html.TextAreaFor(model => model.HotelDescription)
                    @Html.ValidationMessageFor(model => model.HotelDescription)
                </div>
            </div>
        </div>
        <div class="six columns">
            <div class="row">
                <div class="six columns" >
                    <h2>Address</h2>
                </div>
            </div>
            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.Address.Country)
                    @Html.TextBoxFor(model => model.Address.Country)
                    @Html.ValidationMessageFor(model => model.Address.Country)
                </div>
                <div class="six columns">
                    @Html.LabelFor(model => model.Address.Region)
                    @Html.TextBoxFor(model => model.Address.Region)
                    @Html.ValidationMessageFor(model => model.Address.Region)
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.Address.City)
                    @Html.TextBoxFor(model => model.Address.City)
                    @Html.ValidationMessageFor(model => model.Address.City)
                </div>
                <div class="six columns">
                    @Html.LabelFor(model => model.Address.Street)
                    @Html.TextBoxFor(model => model.Address.Street)
                    @Html.ValidationMessageFor(model => model.Address.Street)
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(model => model.Address.PostCode)
                    @Html.TextBoxFor(model => model.Address.PostCode)
                    @Html.ValidationMessageFor(model => model.Address.PostCode)
                </div>
            </div>
        </div>

    </div>
    <div class="row">
        <div class="six columns">
            <div class="row">
                <div class="six columns">
                    <input type="submit" value="Save changes" class="button small success" />
                </div>
            </div>
        </div>
    </div>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/jqueryui")
    <script>
        $.validator.unobtrusive.adapters.addBool("booleanrequired", "required");
        $(function () {
            $('#EarliestCheckIn')
                .attr('readonly', true)
                .timepicker({
                    hourGrid: 4,
                    minuteGrid: 15,
                    stepHour: 1,
                    stepMinute: 15,
                });
            $('#LatestCheckOut')
                .attr('readonly', true)
                .timepicker({
                    hourGrid: 4,
                    minuteGrid: 15,
                    stepHour: 1,
                    stepMinute: 15,
                });
        });
    </script>
}